<!--
*Author：DGZ
 *Contact：jiduxiong@dagongzao.com
 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 *业务请在@/extension/mdsproject/mds_realdevice/Mds_RealDevice.jsx此处编写
 -->
<template>
    <view-grid ref="grid"
               :columns="columns"
               :detail="detail"
               :details="details"
               :editFormFields="editFormFields"
               :editFormOptions="editFormOptions"
               :searchFormFields="searchFormFields"
               :searchFormOptions="searchFormOptions"
               :table="table"
               :extend="extend">
    </view-grid>
</template>
<script>
    import extend from "@/extension/mdsproject/mds_realdevice/Mds_RealDevice.jsx";
    import { ref, defineComponent } from "vue";
    export default defineComponent({
        name: "Mds_RealDevice",
        setup() {
            const table = ref({
                key: "RealDeviceId",
                footer: "Foots",
                cnName: "数据采集设备",
                name: "mds_realdevice/Mds_RealDevice",
                newTabEdit: false,
                url: "/Mds_RealDevice/",
                sortName: "RealDeviceId"
            });
            const editFormFields = ref({"DeviceName":"","Category":"","MachineId":"","DataServeId":"","AliasCode":"","IsMasterDevice":"","Remarks":""});
            const editFormOptions = ref([[{"title":"具体设备名称","field":"DeviceName"},
                               {"dataKey":"enabled","data":[],"title":"设备种类","field":"Category","type":"select"}],
                              [{"dataKey":"BASE_Machine","data":[],"title":"设备ID","field":"MachineId","type":"select"},
                               {"dataKey":"MDS_DataServe","data":[],"title":"数据服务ID","field":"DataServeId","type":"select"}],
                              [{"dataKey":"enabled","data":[],"title":"是否主生产设备","field":"IsMasterDevice","type":"switch"},
                               {"title":"代码别名","field":"AliasCode","type":"text"}],
                              [{"title":"备注","field":"Remarks","colSize":12,"type":"textarea"}]]);
            const searchFormFields = ref({"DeviceName":"","Category":""});
            const searchFormOptions = ref([[{"dataKey":"enabled","data":[],"title":"设备种类","field":"Category","type":"select"},{"title":"具体设备名称","field":"DeviceName","type":"like"}]]);
            const columns = ref([{field:"RealDeviceId",title:"ID",type:"bigint",width:110,hidden:true,readonly:true,require:true,showOverflowTooltip:true,align:"left"},
                       {field:"MachineId",title:"设备ID",type:"bigint",bind:{ key:"BASE_Machine",data:[]},width:110,hidden:true,showOverflowTooltip:true,align:"left"},
                       {field:"CategoryTxt",title:"设备种类",type:"string",width:100,readonly:true,require:true,showOverflowTooltip:true,align:"left"},
                       {field:"DeviceName",title:"具体设备名称",type:"string",width:160,showOverflowTooltip:true,align:"left"},
                       {field:"Machine.MachineCode",title:"主体设备代码",type:"string",width:120,readonly:true,require:true,showOverflowTooltip:true,align:"left"},
                       {field:"Machine.MachineName",title:"主体设备名称",type:"string",width:120,readonly:true,require:true,showOverflowTooltip:true,align:"left"},
                       {field:"Category",title:"设备种类",type:"int",bind:{ key:"enabled",data:[]},width:110,hidden:true,showOverflowTooltip:true,align:"left"},
                       {field:"DataServeId",title:"数据服务ID",type:"bigint",bind:{ key:"MDS_DataServe",data:[]},width:110,showOverflowTooltip:true,align:"left"},
                       {field:"AliasCode",title:"代码别名",type:"string",width:120,showOverflowTooltip:true,align:"left"},
                       {field:"IsMasterDevice",title:"是否主生产设备",type:"int",bind:{ key:"enabled",data:[]},width:120,showOverflowTooltip:true,align:"left"},
                       {field:"IsValid",title:"是否有效",type:"int",width:110,hidden:true,require:true,showOverflowTooltip:true,align:"left"},
                       {field:"CreateId",title:"创建用户",type:"bigint",width:80,hidden:true,showOverflowTooltip:true,align:"left"},
                       {field:"Creator",title:"创建人",type:"string",width:100,showOverflowTooltip:true,align:"left"},
                       {field:"CreateTime",title:"创建时间",type:"datetime",width:110,showOverflowTooltip:true,align:"left"},
                       {field:"ModifyId",title:"修改用户",type:"bigint",width:80,hidden:true,showOverflowTooltip:true,align:"left"},
                       {field:"Modifier",title:"修改人",type:"string",width:100,showOverflowTooltip:true,align:"left"},
                       {field:"ModifyTime",title:"修改时间",type:"datetime",width:110,showOverflowTooltip:true,align:"left"},
                       {field:"Remarks",title:"备注",type:"string",width:150,showOverflowTooltip:true,align:"left"}]);
            const detail = ref(  {
                    cnName: "数据配置",
                    table: "Mds_RealDeviceConfig",
                    columns: [{field:"RealDeviceConfigId",title:"ID",type:"bigint",width:110,hidden:true,readonly:true,require:true,showOverflowTooltip:true,align:"left"},
                       {field:"RealDeviceId",title:"数采设备ID",type:"bigint",width:110,hidden:true,edit:{type:""},showOverflowTooltip:true,align:"left"},
                       {field:"DataProps",title:"数据属性",type:"string",bind:{ key:"enabled",data:[]},width:180,edit:{type:"select"},showOverflowTooltip:true,align:"left"},
                       {field:"DataType",title:"数据类型",type:"int",bind:{ key:"enabled",data:[]},width:110,edit:{type:"select"},showOverflowTooltip:true,align:"left"},
                       {field:"Readable",title:"读属性",type:"int",bind:{ key:"enabled",data:[]},width:110,edit:{type:"switch"},showOverflowTooltip:true,align:"left"},
                       {field:"Writable",title:"写属性",type:"int",bind:{ key:"enabled",data:[]},width:120,edit:{type:"switch"},showOverflowTooltip:true,align:"left"},
                       {field:"DbBlock",title:"数据块-PLC",type:"string",bind:{ key:"enabled",data:[]},width:180,edit:{type:"select"},showOverflowTooltip:true,align:"left"},
                       {field:"Offset",title:"读取偏移量-字节",type:"int",width:110,edit:{type:""},showOverflowTooltip:true,align:"left"},
                       {field:"Length",title:"读取长度-字节",type:"int",width:110,edit:{type:""},showOverflowTooltip:true,align:"left"},
                       {field:"WriteAddress",title:"写地址",type:"string",width:180,edit:{type:""},showOverflowTooltip:true,align:"left"},
                       {field:"IsValid",title:"是否有效",type:"int",width:110,hidden:true,require:true,showOverflowTooltip:true,align:"left"},
                       {field:"CreateId",title:"创建用户",type:"bigint",width:80,hidden:true,showOverflowTooltip:true,align:"left"},
                       {field:"Creator",title:"创建人",type:"string",width:100,showOverflowTooltip:true,align:"left"},
                       {field:"CreateTime",title:"创建时间",type:"datetime",width:110,showOverflowTooltip:true,align:"left"},
                       {field:"ModifyId",title:"修改用户",type:"bigint",width:80,hidden:true,showOverflowTooltip:true,align:"left"},
                       {field:"Modifier",title:"修改人",type:"string",width:100,showOverflowTooltip:true,align:"left"},
                       {field:"ModifyTime",title:"修改时间",type:"datetime",width:110,showOverflowTooltip:true,align:"left"},
                       {field:"Remarks",title:"备注",type:"string",width:150,edit:{type:"textarea"},showOverflowTooltip:true,align:"left"}],
                    sortName: "RealDeviceConfigId",
                    key: "RealDeviceConfigId"
                                            });
            const details = ref([]);
            return {
                table,
                extend,
                editFormFields,
                editFormOptions,
                searchFormFields,
                searchFormOptions,
                columns,
                detail,
                details
            };
        },
    });
</script>
